package com.codeduck.validate.controller;

import com.codeduck.validate.annotation.DateTime;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试自定义检验注解 : http://localhost:8080/validate/test?time=2020-12-21 09:21
 *
 * @author: <a href="mailto:codeduck@163.com">Codeduck</a>
 * @createDate: 2021-12-26
 */
@Validated
@RestController
public class ValidateController {

    @GetMapping("/validate/test")
    public String test(@DateTime(message = "您输入的时间格式错误",
            format = "yyyy-MM-dd HH:mm") String time) {
        return "success ! 你输入的时间为: " + time;
    }
}
